local skel = fk.CreateSkill{
  name = "#ChangeCardDamage",
}
-- 更改牌造成的伤害的类型
skel:addEffect(fk.PreDamage, {
  global = true,
  priority = 0.001,
  can_refresh = function(self, event, target, player, data)
    local usecard = player.room.logic:getCurrentEvent():findParent(GameEvent.UseCard)
    if data.to == player 
    and usecard and usecard.data.extra_data and usecard.data.extra_data.ChangeDamageType
    and data.card and player.room.logic:damageByCardEffect() then
      event:setCostData(self, {damageType = usecard.data.extra_data.ChangeDamageType})
      return true
    end
  end,
  on_refresh = function(self, event, target, player, data)
    data.damageType = event:getCostData(self).damageType
  end,
})

-- 更改牌造成的伤害值
skel:addEffect(fk.PreDamage, {
  global = true,
  priority = 0.001,
  can_refresh = function(self, event, target, player, data)
    local usecard = player.room.logic:getCurrentEvent():findParent(GameEvent.UseCard)
    if data.to == player 
    and usecard and usecard.data.extra_data and usecard.data.extra_data.ChangeDamageNum
    and data.card and player.room.logic:damageByCardEffect() then
      event:setCostData(self, {damageNum = usecard.data.extra_data.ChangeDamageNum})
      return true
    end
  end,
  on_refresh = function(self, event, target, player, data)
    data.damage = event:getCostData(self).damageNum
    if data.damage < 1 then
      data:preventDamage()
    end
  end,
})

return skel